//
//  FGNoticeView.h
//  FGChatKit
//
//  Created by Henry on 2021/9/26.
//

#import <UIKit/UIKit.h>
#import "FGNoticeContentProtocol.h"
@class FGNoticeView;

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, FGNoticeType) {
    FGNoticeTypeNone,
    FGNoticeTypeButton,
    FGNoticeTypeOpen,
    /// 自动消失，间隔时间默认：2s
    FGNoticeTypeAutoDismiss,
    FGNoticeTypeCustom,
};

@protocol FGNoticeViewDelegate <NSObject>

@required

- (void)noticeView:(FGNoticeView *)view updateHeight:(CGFloat)height;


@optional

- (void)noticeView:(FGNoticeView *)view clickTitle:(NSString *)title;

@end

@interface FGNoticeView : UIView

@property (nonatomic, weak) id <FGNoticeViewDelegate> delegate;

@property (nonatomic, copy) NSString *title;

@property (nonatomic, assign) FGNoticeType type;

@property (nonatomic, assign) NSTextAlignment titleAlignment;

/// 打开选项
@property (nonatomic, assign) BOOL open;

/// 50
@property (nonatomic, assign) CGFloat minHeight;
/// 160
@property (nonatomic, assign) CGFloat maxHeight;

/// type =  FGNoticeTypeAutoDismiss 有效， 自动消失，间隔时间默认：2s
@property (nonatomic, assign) CGFloat dismissDuration;

- (void)resetSize:(CGSize)size;

- (void)show:(UIView *)view title:(NSString *)title;
- (void)show:(UIView *)view title:(NSString *)title type:(FGNoticeType)type;
- (void)show:(UIView *)view title:(NSString *)title type:(FGNoticeType)type contentView:(nullable UIView<FGNoticeContentProtocol> *)contentView;

- (void)dismiss;

@end

NS_ASSUME_NONNULL_END
